from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.urls import path

from apps.user import views
from apps.user.views import RegisterView, ActiveView, LoginView, UserInfoView, AddressView, UserOrderView, LogoutView

app_name = 'user'
urlpatterns = [

    # url(r'^register$',views.register,name='register'), # 注册
    # url(r'^register_handle$',views.register_handle,name='register_handle'), # 注册数据处理

    path('register', RegisterView.as_view(), name='register'),
    # 括号捕获的数据
    path('activer/<int:token>', ActiveView.as_view(), name='active'),

    path('login', LoginView.as_view(), name='login'),
    path('logout', LogoutView.as_view(), name='logout'),

    # login_required Django自带的装饰器 用于拦截之用
    path('', UserInfoView.as_view(), name='user'),
    path('order/<int:page>', UserOrderView.as_view(), name='order'),
    path('address', AddressView.as_view(), name='address'),
]
